using System;
using System.Collections.Generic;

namespace PeDALS.Tools.AZ.PSTArchive.PSTData
{
    public class TreeBlockEntry : TreeEntry
    {
        private UInt64 m64BIDraw;
        private long mlngBlockAddress;
        private short mshtBlockLength;
        private short mshtBlockReferenceCount;
        private List<string> mlstrPath = new List<string>();

        public TreeBlockEntry(UInt64 ui64BIDraw, long lngBlockAddress, short shtBlockLength, short shtBlockReferenceCount, string strPath, long lngEntryAddress)
            : base(strPath, lngEntryAddress)
        {
            m64BIDraw = ui64BIDraw;
            mlngBlockAddress = lngBlockAddress;
            mshtBlockLength = shtBlockLength;
            mshtBlockReferenceCount = shtBlockReferenceCount;
            mlstrPath.Add(this.EntryPath);
        }

        public UInt64 BIDraw
        {
            get { return m64BIDraw; }
        }

        public UInt64 BID
        {
            get { return m64BIDraw >> 2; }
        }

        public bool Reserved
        {
            get { return Convert.ToBoolean(m64BIDraw & 0x1); }
        }

        public bool Internal
        {
            get { return Convert.ToBoolean((m64BIDraw & 0x2) >> 1); }
        }

        public long BlockAddress
        {
            get { return mlngBlockAddress; }
        }
 
        public short BlockLength
        {
            get { return mshtBlockLength; }
        }

        public short BlockReferenceCount
        {
            get { return mshtBlockReferenceCount; }
        }

        public List<string> PathList
        {
            get { return mlstrPath; }
        }
    }
}